<template>
  <div class="menu-bar">
    <transition name="silde-up">
      <div class="menu-wrapper"
      v-show="menuVisible"
      :class="{'hide-box-shadow': settingVisible >= 1 || !menuVisible}"
      >
        <div class="icon-wrapper" @click="handleShowSetting(1)">
          <div class="icon-menu icon"></div>
        </div>
        <div class="icon-wrapper"  @click="handleShowSetting(2)">
          <div class="icon-progress icon"></div>
        </div>
        <div class="icon-wrapper"  @click="handleShowSetting(3)">
          <div class="icon-bright icon"></div>
        </div>
        <div class="icon-wrapper"  @click="handleShowSetting(4)">
          <div class="icon-A icon"></div>
        </div>
      </div>
    </transition>
    <EbookSettingFontSize />
    <EbookSettingFontPopUp />
    <EbookSettingTheme />
  </div>
</template>

<script>
import { ebookMixin } from '../../utils/mixin'
import EbookSettingFontSize from './EbookSettingFont.vue'
import EbookSettingFontPopUp from './EbookSettingFontPopUp'
import EbookSettingTheme from './EbookSettingTheme.vue'
export default {
  name: 'EbookMenu',
  mixins: [ebookMixin],
  components: {
    EbookSettingFontSize,
    EbookSettingFontPopUp,
    EbookSettingTheme
  },
  methods: {
    handleShowSetting (key) {
      if (key === this.settingVisible) {
        this.setSettingVisible(0)
      } else {
        this.setSettingVisible(key)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
@import "../../assets/styles/global";
    .menu-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    width: 100%;
    height: px2rem(48);
    box-shadow: 0 px2rem(-8) px2rem(8) rgba(0, 0, 0, .15);
    font-size: px2rem(22);
    background-color: white;
    &.hide-box-shadow {
      box-shadow: none;
    }
    .icon-wrapper {
      flex: 1;
      @include center;
      .icon-progress {
        font-size: px2rem(24);
      }
      .icon-A {
        font-size: px2rem(20);
      }
    }
  }
</style>
